﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Models;
using BLL;

namespace Dryricenet.houTai
{
    public partial class user_Detailed : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string name = Session["UserName"].ToString();
                //根据id查询数据，并展示在输入框中
                DataTable dt = userBLL.selectNameBll(name);
                //用DataRow来存一行数据
                DataRow dr = dt.Rows[0];//第一条数据
                                        //把数据一个一个的放进输入框里
                lname.Text = dr["UserName"].ToString();
                age.Text = dr["Age"].ToString();
                phone.Text = dr["Phone"].ToString();
                string num = dr["UserTypeID"].ToString();
                if (num == "1")
                {
                    leix.Text = "用户";
                }
                else
                {
                    leix.Text = "管理员";
                }
                sf.Text = dr["Titles"].ToString();
                //性别处理
                if (dr["Sex"].ToString() == "男")
                {
                    sex.Text= "男";
                }
                else
                {
                    sex.Text = "女";
                }
            }
        }
    } 
}